﻿namespace SampleDdeCustomTable
{
	using System;

	using Ecng.Common;
	using Ecng.Serialization;

	using StockSharp.Quik;

    public class QuikCandleDateTime : Equatable<QuikCandleDateTime>
    {
        [DdeCustomColumn("Дата", Order = 0)]
        public string Date { get; set; }

        [DdeCustomColumn("Время", Order = 1)]
        public string Time { get; set; }

        public override QuikCandleDateTime Clone()
        {
            throw new NotImplementedException();
        }

        public override int GetHashCode()
        {
            return this.Date.GetHashCode() ^ this.Time.GetHashCode();
        }

        protected override bool OnEquals(QuikCandleDateTime other)
        {
            return this.Date == other.Date && this.Time == other.Time;
        }
    }

	[DdeCustomTable("Исторические свечки")]
	public class QuikCandle
	{
		[Identity]
		[InnerSchema]
        public QuikCandleDateTime DateTime { get; set; }
		
        //[DdeCustomColumn("DateTime", Order = 2)]
        //public int DateTimeS { get; set; }

        [DdeCustomColumn("date", Order = 0)]
        public int date { get; set; }

        [DdeCustomColumn("time", Order = 1)]
        public int time { get; set; }

		[DdeCustomColumn("per", Order = 3)]
		public int per { get; set; }

		[DdeCustomColumn("ticker", Order = 4)]
		public string SecCode { get; set; }

        [DdeCustomColumn("seccode_trans", Order = 5)]
        public string seccode_trans { get; set; }

		[DdeCustomColumn("Цена открытия", Order = 6)]
		public decimal OpenPrice { get; set; }

		[DdeCustomColumn("Максимальная цена", Order = 7)]
		public decimal HighPrice { get; set; }

		[DdeCustomColumn("Минимальная цена", Order = 8)]
		public decimal LowPrice { get; set; }

		[DdeCustomColumn("Цена закрытия", Order = 9)]
		public decimal ClosePrice { get; set; }

		[DdeCustomColumn("Объем", Order = 10)]
		public int Volume { get; set; }

		[DdeCustomColumn("macd", Order = 11)]
        public decimal MACD { get; set; }

		[DdeCustomColumn("macdg", Order = 12)]
        public decimal MACDG { get; set; }

		[DdeCustomColumn("macds", Order = 13)]
        public decimal MACDS { get; set; }

        [DdeCustomColumn("elder", Order = 14)]
        public decimal elder { get; set; }

        [DdeCustomColumn("tenkan", Order = 15)]
        public decimal tenkan { get; set; }

        [DdeCustomColumn("kijun", Order = 16)]
        public decimal kijun { get; set; }

        [DdeCustomColumn("senkou_span1", Order = 17)]
        public decimal senkou_span1 { get; set; }

        [DdeCustomColumn("senkou_span2", Order = 18)]
        public decimal senkou_span2 { get; set; }


        [DdeCustomColumn("chinkou", Order = 19)]
        public decimal chinkou { get; set; }



 //output = SET_VALUE(output, "Per", timeframe)
 //output = SET_VALUE(output, "seccode", seccode)

 //output = SET_VALUE(output, "Date", dateString)
 //output = SET_VALUE(output, "Time", timeString)
 //output = SET_VALUE(output, "DateTime", dateString&timeString)
 //output = SET_VALUE(output, "OpenPrice", open)
 //output = SET_VALUE(output, "HighPrice", high)
 //output = SET_VALUE(output, "LowPrice", low)
 //output = SET_VALUE(output, "ClosePrice", close)
 //output = SET_VALUE(output, "Volume", volume)

 //output = SET_VALUE(output, "macd",  macd)
 //output = SET_VALUE(output, "macdg", macdg)
 //output = SET_VALUE(output, "macds", macds)

	}
}